package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.NoticeDao;
import com.neuedu.model.Notice;

@Repository
public class NoticeDaoImpl implements NoticeDao {

	// 代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countNotice() {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(NoticeDao.class).countNotice();
	}

	@Override
	public List<Notice> findAll(Map<String, Object> map) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(NoticeDao.class).findAll(map);
	}

	@Override
	public int addNotice(Notice n) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(NoticeDao.class).addNotice(n);
	}

	@Override
	public int deleteNotice(int id) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(NoticeDao.class).deleteNotice(id);
	}
	
	@Override
	public List<Notice> findTitle() {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(NoticeDao.class).findTitle();
	}

	@Override
	public Notice findNoticeById(Notice n) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(NoticeDao.class).findNoticeById(n);
	}


}
